package 多线程.多线程创建.线程安全.同步代码块;


public class MyTicket_Main {

    public static void main(String[] args) throws InterruptedException {
       MyTicket myTicket = new MyTicket();

        Thread person01 = new Thread(myTicket, "用户1");
        Thread person02 = new Thread(myTicket, "用户2");
        Thread person03 = new Thread(myTicket, "用户3");

        person01.start();
        person02.start();
        person03.start();
    }
}
/**
 * 用户3抢到了第3张票
 * 用户2抢到了第2张票
 * 用户1抢到了第1张票
 */